package com.wmx.thread.dayOne;

public class PrintChar extends Thread{
    private PrintStuff c;
    public PrintChar(PrintStuff a){
        this.c = a;}
    @Override
    public void run(){
        synchronized(c){
        while(c.cha<='Z'){

                if(!c.flag){
                    System.out.print(c.cha);
                    c.cha++;
                    c.flag = true;
                    c.notify();
                }
                else {
                    try {
                        c.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

}
